import api from '../../../http/api.js'
import ElementUI from 'element-ui'
export default {
  // 获取基金经理列表
  async FundManagerManagementList({ state, commit }, value) {
    const res = await api.FundManagerManagement.FundManagerManagementListData(state.page, state.limit)
    if (res.code == 200) {
      commit('FUNDMANGERMANGAGEMENTLIST', res.data)
    }
  },
  // 新增基金经理
  async AddManagerManagements(context, value) {
    const res = await api.FundManagerManagement.AddManagerManagement(value);
    console.log(value,'value')
    if (res.code == 200) {
      ElementUI.Message.success('删除成功!');
    } else {
      ElementUI.Message.error('删除失败!');
    }
  },
  // 每页显示多少条
  Showlimit({ commit, dispatch }, value) {
    commit('SHOWLIMIT', value)
    dispatch('FundManagerManagementList')
  },
  // 上一页下一页
  NextPage({ commit, dispatch }, value) {
    commit('NEXTPAGE', value)
    dispatch('FundManagerManagementList')
  },
  // 删除基金经理数据
  async DeletefundManager(context, value) {
    const res = await api.FundManagerManagement.DeleteManagerManagement(value)
    if (res.code == 200) {
      ElementUI.Message.success('删除成功!');
      dispatch('FundManagerManagementList')
    } else {
      ElementUI.Message.error('删除失败!');
    }
  },
  // 修改
  async updatefundManager(context,value) {
    const res = await api.FundManagerManagement.updateManager(value)
    if(res.code==200){
      ElementUI.Message.success('删除成功!');
    }else {
      ElementUI.Message.error('删除失败!');
    }
  }
}